/*************************************************************************
	> File Name: P2043.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-01-08 18:16:51
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    for (int i = 2; i <= n; i++) {
        int m = i, j = 2;;
        while (j * j <= m) {
            int cnt = 0;
            while (m % j == 0) {
                m /= j;
                cnt += 1;
            }
            mp[j] += cnt;
            j++;
        }
        if (m != 1) mp[m] += 1;
    }
    for (int i = 2; i <= n; i++) {
        if (mp[i] == 0) continue;
        cout << i << " " << mp[i] << endl;
    }
    return 0;
}
